<?php
namespace app\common\lib\user_operate;

use app\common\lib\Common;
use app\common\lib\EntranceToken as ET;

class UserOperate
{
    protected $common; //操作实例
    public function __construct()
    {
        $this->common = new Common;
    }

    /**
     *新用户注册激活
     */
    public function activation($name, $pwd)
    {
        $res = ET::active('1020042101', $name, $pwd);
        return $res;
    }

    /**
     * 激活成功
     */
    public function activeSuccess($name, $pwd)
    {
        $res = ET::active('2220042102', $name, $pwd);
        return $res;
    }

    /**
     *修改密码
     */
    public function modify($old, $new)
    {
        $data = [
            'token' => ET::getToken(),
            'param' => [
                'type' => '2024042104',
                'old'  => base64_encode($old),
                'new'  => base64_encode($new),
            ],
        ];
        $res = $this->common->requestInterface(ET::getUrl(), $data);
        return $res;
    }
    
    /**
     * 获取菜单
     */
    public function getMenu()
    {
        $data = [
            'token' => ET::getToken(),
            'param' => [
                'type' => '2030042103',
            ],
        ];
        $res = $this->common->requestInterface(ET::getUrl(), $data);
        return $res;
    }
}
